Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix DST boundary issue occurring on Cloudflare env (fixes #108) #114

Merged
merged 1 commit into from
Nov 16, 2024

Conversation

benvinegar
Copy link
Owner

Daylight savings hack. Cloudflare Workers uses a different Date implementation than Node 20.x, which doesn't seem to respect DST boundaries the same way (see: #108).

To work around this, instead of adding 1 day, we add 25 hours every increment (intentionally overshooting), then grab the start of the day from that time, and repeat. This works in both Node 20.x and the production Cloudflare Workers environment.

NOTE: There's already a DST boundary test, but it was always passing since it was running in a Node environment.

Copy link

codecov bot commented Nov 16, 2024

Codecov Report

Attention: Patch coverage is 81.81818% with 2 lines in your changes missing coverage. Please review.

Project coverage is 72.90%. Comparing base (5ae04f2) to head (e01be48).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
app/analytics/query.ts 81.81% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #114   +/-   ##
=======================================
  Coverage   72.89%   72.90%           
=======================================
  Files          32       32           
  Lines        2225     2233    +8     
  Branches      219      222    +3     
=======================================
+ Hits         1622     1628    +6     
- Misses        595      597    +2     
  Partials        8        8           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@benvinegar benvinegar merged commit 54edba1 into main Nov 16, 2024
3 checks passed
@benvinegar benvinegar deleted the fix-dst-buckets branch November 16, 2024 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant